package com.zk.util;

import java.util.HashMap;
import java.util.Map;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zk.service.IRadioService;

@Component
@RabbitListener(queues = "TestDirectQueue")//监听的队列名称 TestDirectQueue
public class DirectReceiver {
	
	@Autowired
	IRadioService radioService;
	
	@RabbitHandler
    public void process(Map testMessage) {
		Map<String,Object> map = new HashMap<>();
		map.put("success", "00");
		map.put("title", "有新消息");
		map.put("content", testMessage.toString());
		System.out.println("DirectReceiver消费者收到消息  : " + testMessage.toString());
		radioService.receiveMsg(map);
    }
}
